package com.projecetest.eduservice.controller;


import com.projecetest.commonutils.R;
import com.projecetest.eduservice.entity.EduVideo;
import com.projecetest.eduservice.service.EduVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 课程视频 前端控制器
 * </p>
 *
 * @author Captain
 * @since 2021-08-04
 */
@RestController
@RequestMapping("/eduservice/video")
@CrossOrigin
public class EduVideoController {
    @Autowired
    private EduVideoService eduVideoService;
    //添加小节
    @PostMapping("addVideo")
    public R addVideo(@RequestBody EduVideo eduVideo){
        eduVideoService.save(eduVideo);
        return R.ok();
    }
    //删除小节
    @DeleteMapping("{videoId}")
    public R deleteVideo(@PathVariable String videoId){
        eduVideoService.removeById(videoId);
        return R.ok();
    }
    //修改小节
//    @PostMapping("updateVideo")
//    public R updateVideo(@RequestBody EduVideo eduVideo){
//        eduVideoService.updateById(eduVideo);
//        return R.ok();
//    }
}

